package wef.PW.module.model;

public class APDU {

    private String UDID; // 标识符 68 两位
    private String APDUL; // 报文长度 两位
    private String CLDN1; // 控制域1 两位
    private String CLDN2; // 控制域2 两位
    private String CLDN3; // 控制域3 两位
    private String CLDN4; // 控制域4 两位
    private ASDU asdu; //应用服务数据单元 i格式有

    /**
     * 获取报文模板
     * @return
     */
    public String getReward(){
        String reward = this.UDID + this.APDUL + this.CLDN1 + this.CLDN2 + this.CLDN3 + this.CLDN4;
//        if (type.equals("U") || type.equals("S"))
//            return reward;
//        else if (type.equals("I")) {
//            return reward + this.asdu.getReward();
//        }
        return reward;
    }

    public APDU(){
        this.UDID = "68";
        this.APDUL = "00";
        this.CLDN1 = "00";
        this.CLDN2 = "00";
        this.CLDN3 = "00";
        this.CLDN4 = "00";
    }
    @Override
    public String toString() {

        return "报文(APDU):{" +
                "  \n   标识符(UDID)='" + UDID + '\'' +
                ", \n   报文长度(APDU)='" + APDUL + '\'' +
                ", \n   控制域(CLDN):" +
                ", \n       控制域1(C1)='" + CLDN1 + '\'' +
                ", \n       控制域2(C2)='" + CLDN2 + '\'' +
                ", \n       控制域3(C3)='" + CLDN3 + '\'' +
                ", \n       控制域4(C4)='" + CLDN4 + '\'' +
                ", \n       应用服务数据单元(ASDU)='" + asdu + '\'' +
                '}';
    }

    public String getUDID() {
        return UDID;
    }

    public void setUDID(String UDID) {
        this.UDID = UDID;
    }

    public String getAPDUL() {
        return APDUL;
    }

    public void setAPDUL(String APDUL) {
        this.APDUL = APDUL;
    }

    public String getCLDN1() {
        return CLDN1;
    }

    public void setCLDN1(String CLDN1) {
        this.CLDN1 = CLDN1;
    }

    public String getCLDN2() {
        return CLDN2;
    }

    public void setCLDN2(String CLDN2) {
        this.CLDN2 = CLDN2;
    }

    public String getCLDN3() {
        return CLDN3;
    }

    public void setCLDN3(String CLDN3) {
        this.CLDN3 = CLDN3;
    }

    public String getCLDN4() {
        return CLDN4;
    }

    public void setCLDN4(String CLDN4) {
        this.CLDN4 = CLDN4;
    }

    public ASDU getAsdu() {
        return asdu;
    }

    public void setAsdu(ASDU asdu) {
        this.asdu = asdu;
    }
}
